/*
 * @lc app=leetcode.cn id=53 lang=golang
 *
 * [53] 最大子序和
 */

// @lc code=start
func maxSubArray(nums []int) int {
	l:=len(nums)
	if l==0{
		return 0
	}else if l==1{
		return nums[0]
	}else {
		m:=map[int]int
		m[0] = arr[0]
		maxv:=arr[0]
		for i:=1;i<l;i++{
			m[i] = max(arr[i],arr[i]+m[i-1])
			maxv = max(m[i],maxv)
		}
		return maxv
	}
}

func max(a,b int)int{
	if a>b{
		return a
	}else{
		return b
	}
}
// @lc code=end

